import request from '@/utils/request'

export async function getSchoolList(year){
  let res = await request({
    url: '/getSchoolList',
    method: 'get',
    timeout: 5000,
    params: {
        year:year
    }
  })
  console.log(res.data.returnData);
  return res.data.returnData;
}
export async function login(XXID,username, password,server) {
console.log(XXID,username,password)
  
  let res = await request({
    url: '/login',
    method: 'get',
    timeout: 5000,
    params: {
        XXID:XXID,
        number:  username,
        password: password,
        server:server
    }
  })
  console.log(res.data);
  return res.data;
  // return new Promise(async(resolve, reject) => {
  //   if (username === 'admin' && password === '123') {
  //     resolve({ role: 'admin', token: 1, username: 'admin',XXID:'1234','CJPC':'2019',password: 'admin' })
  //   } else if (username === 'user' && password === '123') {
  //     resolve({ role: 'user', token: 2, username: 'user', password: '123',XXID:'123',CJPC:'2019' })
  //   } else {
  //     resolve({ })
  //   }
  // })
}

export function logout() {
  // return request({
  //   url: '/user/logout',
  //   method: 'post'
  // })
  return new Promise(async(resolve, reject) => {
    resolve()
  })
}
